/* GUI CONVERTED from rcshrp1b.p (converter v1.76) Fri May  3 13:22:12 2002 */
/* rcshrp1b.p - Shipper  Report - PRINT SHIPPER LINES                        */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                       */
/* All rights reserved worldwide.  This is an unpublished work.              */
/* $Revision: 1.6.1.5 $                                                         */
/*V8:ConvertMode=Report                                                      */
/* REVISION: 8.6      LAST MODIFIED: 10/09/96   BY: *K003* Kieu Nguyen       */
/* REVISION: 8.6      LAST MODIFIED: 03/15/97   BY: *K04X* Steve Goeke       */
/* REVISION: 8.6      LAST MODIFIED: 04/25/97   BY: *K0CH* Taek-Soo Chang    */
/* REVISION: 8.6      LAST MODIFIED: 07/30/97   BY: *K0H7* Taek-Soo Chang    */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane         */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan        */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan        */
/* REVISION: 9.1      LAST MODIFIED: 09/23/99   BY: *K230* Santosh Rao       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane  */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb               */
/* REVISION: 9.1      LAST MODIFIED: 01/25/01   BY: *M101* Rajesh Thomas     */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.6.1.5 $    BY: Katie Hilbert         DATE: 04/15/02  ECO: *P03J*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* INPUT PARAM */
define input parameter abs_recid  as recid.
define input parameter indent_ct  as integer.
define input parameter sched_date as date.

/* SHARED VARIABLE */
define shared variable part   like pt_part no-undo.
define shared variable part1  like pt_part no-undo.
define shared variable sonbr  like so_nbr no-undo.
define shared variable sonbr1 like so_nbr no-undo.
define shared variable stype  as character no-undo.
define shared frame c.

/* LOCAL VARIABLE */
define variable indent_id     as character format "x(12)" label "Type".
define variable par_shipfrom  as character.
define variable par_id        as character.
define variable open_qty      like sod_qty_ord label "Open Qty".
define variable due_date      like sod_due_date.
define variable sched_netting as logical initial no.
define variable l_shipper_po  like sod_contr_id format "x(22)" no-undo.

FORM /*GUI*/ 
   indent_id
   abs_item     column-label "Ship-To!Item Number!Model Year"
   scx_po       column-label "ID!PO Number!Customer Ref"
   abs_site     column-label "Ship-From!Site"
   abs_order    column-label "Inv Mov!Order"
   abs_line     column-label "Line"
   pt_um
   open_qty
   due_date
   abs_qty      format "->,>>>,>>9.9<<<"
   abs_shp_date
with STREAM-IO /*GUI*/  frame c down width 132 no-box.

/* SET EXTERNAL LABELS */
setFrameLabels(frame c:handle).

find abs_mstr where recid(abs_mstr) = abs_recid no-lock.

if indent_ct = 0 or
   abs_id begins "c" or
   ((abs_item >= part and abs_item <= part1) and
   (abs_order >= sonbr and abs_order <= sonbr1))
then do:

   find pt_mstr where pt_part = abs_item no-lock no-error.

   if indent_ct = 0 then
      indent_id = stype.
   else
      indent_id = substring("...........",1,indent_ct) +
                  if abs_id begins "i" then "I" else abs_id.

   indent_id = caps(indent_id).

   find so_mstr where so_nbr = abs_order no-lock no-error.
   find sod_det where sod_nbr = abs_order and
                      sod_line = integer(abs_line)
   no-lock no-error.

   if available sod_det
   then do:
      if sod_sched
      then do:
         {gprun.i ""rcoqty.p""
            "(input recid(sod_det),
              input sched_date,
              input sched_netting,
              output open_qty)"}.
         due_date = sched_date.
      end.
      else
         assign
            due_date = sod_due_date
            open_qty = sod_qty_ord - sod_qty_ship.
   end.  /* if available sod_det */
   else
      open_qty = 0.

   if available sod_det
   then do:
      if sod_sched then
         l_shipper_po = sod_contr_id.
      else
      if available so_mstr then
         l_shipper_po = so_ship_po.
   end. /* IF AVAILABLE SOD_DET */
   else do:
      for first idh_hist
         fields(idh_contr_id idh_line idh_nbr idh_part idh_sched)
         where idh_nbr = abs_order
           and idh_line = integer (abs_line)
           and idh_part = abs_item no-lock:
      end. /* FOR FIRST IDH_HIST */
      if available idh_hist
      then do:
         if idh_sched then
            l_shipper_po = idh_contr_id.
         else
            for first ih_hist
               fields(ih_nbr ih_ship_po)
               where ih_nbr = idh_nbr no-lock:
               l_shipper_po = ih_ship_po.
            end. /* FOR FIRST IH_HIST */
      end. /* IF AVAILABLE IDH_HIST */
      else
         l_shipper_po = "".
   end. /* IF NOT AVAILABLE SOD_DET */

   if indent_ct = 0
   then
      display
         indent_id
         abs_shipfrom        @ abs_site
         abs_shipto          @ abs_item
         abs_inv_mov         @ abs_order
         substring(abs_id,2) @ scx_po
      with frame c STREAM-IO /*GUI*/ .
   else do:
      display
         indent_id
         abs_item
         l_shipper_po @ scx_po
         abs_site
         abs_order
         string(integer(abs_line),">>>9") format "x(4)" @ abs_line
         abs_qty
         pt_um      when (available pt_mstr)
         open_qty
         due_date
         abs_shp_date
      with frame c STREAM-IO /*GUI*/ .
      down 1 with frame c.
      display
         sod_modelyr when (available sod_det) @ abs_item
         sod_custref when (available sod_det) @ scx_po
      with frame c STREAM-IO /*GUI*/ .
   end.

   down 1 with frame c.

end.

if abs_id begins "i" then return.

assign
   par_shipfrom = abs_shipfrom
   par_id = abs_id.

for each abs_mstr no-lock
   where abs_shipfrom = par_shipfrom
     and abs_par_id = par_id:

   if (abs_order >= sonbr and abs_order <= sonbr1 and
       abs_item  >= part  and abs_item  <= part1) or
      abs_id begins "c"
   then do:

      {gprun.i ""rcshrp1b.p""
         "(input recid(abs_mstr),
           input (indent_ct + 1),
           input sched_date)"}
   end.
end.
